package com.cf.model;

import com.cf.code.core.CField;
import com.cf.code.core.CModel;
import com.cf.code.core.CPage;
import com.cf.crud.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * wine-Connection
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/6/15 下午 01:08
 */
@Entity
@Table(name = "connection")
@CModel(pages = {
        @CPage(title = "联系列表", path = "connection", templateName = "list.ftl", outPutName = "list.ftl"),
        @CPage(title = "联系", path = "connection", templateName = "add.ftl", outPutName = "add.ftl"),
        @CPage(title = "联系", path = "connection", templateName = "update.ftl", outPutName = "update.ftl")
})
public class Connection extends BaseEntity {

    @NotEmpty
    @CField(lab = "联系人名字")
    @Column(name = "name")
    private String name;

    @NotEmpty
    @CField(lab = "联系人手机")
    @Column(name = "phone")
    private String phone;

    @NotEmpty
    @CField(lab = "联系人地址")
    @Column(name = "address")
    private String address;

    @NotEmpty
    @CField(lab = "中意商品")
    @Column(name = "wine")
    private String wine;


    @CField(lab = "提交时间")
    @Column(name = "addTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Temporal(TemporalType.TIMESTAMP)
    private Date addTime = new Date();

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public String getWine() {
        return wine;
    }

    public void setWine(String wine) {
        this.wine = wine;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
